#include <iostream>
#include <functional>

class Device1 {
private:
	short temperature()
	{
		std::cout << "Device1 temperature" << std::endl;
		return 11;
	}
	short wetness()
	{
		std::cout << "Device1 wetness" << std::endl;
		return 12;
	}
	int illumination()
	{
		std::cout << "Device1 illumination" << std::endl;
		return 13;
	}
	int atmospheric_pressure()
	{
		std::cout << "Device1 atmospheric_pressure" << std::endl;
		return 14;
	}
	void wait_for_data()
	{
		std::cout << "Device1 wait_for_data" << std::endl;
	}
public:
	template <class FuncT>
	void watch(const FuncT& f) {
		// for (;;) {
			wait_for_data();
			f(
				temperature(),
				wetness(),
				illumination(),
				atmospheric_pressure()
			);
		// }
	}
};

class Device2 {
private:
	short temperature()
	{
		std::cout << "Device2 temperature" << std::endl;
		return 21;
	}
	short wetness()
	{
		std::cout << "Device2 wetness" << std::endl;
		return 22;
	}
	int illumination()
	{
		std::cout << "Device2 illumination" << std::endl;
		return 23;
	}
	int atmospheric_pressure()
	{
		std::cout << "Device2 atmospheric_pressure" << std::endl;
		return 24;
	}
	void wait_for_data()
	{
		std::cout << "Device2 wait_for_data" << std::endl;
	}
public:
	template <class FuncT>
	void watch(const FuncT& f) {
		// for (;;) {
			wait_for_data();
			f(
				temperature(),
				wetness(),
				illumination(),
				atmospheric_pressure()
			);
		// }
	}
};

void detect_storm(int wetness, int temperature, int atmospheric_pressure)
{
	std::cout << "wetness:" << wetness << "  "
		<< "temperature:" << temperature << "  "
		<< "atmospheric_pressure:" << atmospheric_pressure << "  "
		<< std::endl;
}

int main()
{
	using namespace std::placeholders;

	Device1 d1;
	d1.watch(std::bind(&detect_storm, _2, _1, _4));
	Device2 d2;
	d2.watch(std::bind(&detect_storm, _1, _2, _3));

	return 0;
}